<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QStatusBar Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStatusBar Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStatusBar class provides a horizontal bar suitable for
presenting status information. <a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstatusbar.html#QStatusBar">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qstatusbar.html#addWidget">addWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qstatusbar.html#clearMessage">clearMessage</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qstatusbar.html#currentMessage">currentMessage</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qstatusbar.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#hideOrShow">hideOrShow</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qstatusbar.html#insertPermanentWidget">insertPermanentWidget</a></b> (<i>self</i>, int&#160;<i>index</i>, QWidget&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qstatusbar.html#insertWidget">insertWidget</a></b> (<i>self</i>, int&#160;<i>index</i>, QWidget&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</li><li><div class="fn" />bool <b><a href="qstatusbar.html#isSizeGripEnabled">isSizeGripEnabled</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#reformat">reformat</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#removeWidget">removeWidget</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qstatusbar.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#setSizeGripEnabled">setSizeGripEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qstatusbar.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li><li><div class="fn" /><b><a href="qstatusbar.html#showMessage">showMessage</a></b> (<i>self</i>, QString&#160;<i>message</i>, int&#160;<i>msecs</i>&#160;=&#160;0)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qstatusbar.html#messageChanged">messageChanged</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStatusBar class provides a horizontal bar suitable for
presenting status information.</p>
<p>Each status indicator falls into one of three categories:</p>
<ul>
<li><i>Temporary</i> - briefly occupies most of the status bar.
Used to explain tool tip texts or menu entries, for example.</li>
<li><i>Normal</i> - occupies part of the status bar and may be
hidden by temporary messages. Used to display the page and line
number in a word processor, for example.</li>
<li><i>Permanent</i> - is never hidden. Used for important mode
indications, for example, some applications put a Caps Lock
indicator in the status bar.</li>
</ul>
<p>QStatusBar lets you display all three types of indicators.</p>
<p>Typically, a request for the status bar functionality occurs in
relation to a <a href="qmainwindow.html">QMainWindow</a> object.
<a href="qmainwindow.html">QMainWindow</a> provides a main
application window, with a menu bar, tool bars, dock widgets
<i>and</i> a status bar around a large central widget. The status
bar can be retrieved using the <a href="qmainwindow.html#statusBar">QMainWindow.statusBar</a>() function,
and replaced using the <a href="qmainwindow.html#setStatusBar">QMainWindow.setStatusBar</a>()
function.</p>
<p>Use the <a href="qstatusbar.html#showMessage">showMessage</a>()
slot to display a <i>temporary</i> message:</p>
<pre class="cpp">
 <span class="type">void</span> MainWindow<span class="operator">.</span>createStatusBar()
 {
     statusBar()<span class="operator">-</span><span class="operator">&gt;</span>showMessage(tr(<span class="string">"Ready"</span>));
 }
</pre>
<p>To remove a temporary message, use the <a href="qstatusbar.html#clearMessage">clearMessage</a>() slot, or set a
time limit when calling <a href="qstatusbar.html#showMessage">showMessage</a>(). For example:</p>
<pre class="cpp">
 <span class="type">void</span> MainWindow<span class="operator">.</span>print()
 {
 <span class="preprocessor">#ifndef QT_NO_PRINTDIALOG</span>
     <span class="type"><a href="qtextdocument.html">QTextDocument</a></span> <span class="operator">*</span>document <span class="operator">=</span> textEdit<span class="operator">-</span><span class="operator">&gt;</span>document();
     <span class="type"><a href="qprinter.html">QPrinter</a></span> printer;

     <span class="type"><a href="qprintdialog.html">QPrintDialog</a></span> <span class="operator">*</span>dlg <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qprintdialog.html">QPrintDialog</a></span>(<span class="operator">&amp;</span>printer<span class="operator">,</span> <span class="keyword">this</span>);
     <span class="keyword">if</span> (dlg<span class="operator">-</span><span class="operator">&gt;</span>exec() <span class="operator">!</span><span class="operator">=</span> <span class="type"><a href="qdialog.html">QDialog</a></span><span class="operator">.</span>Accepted)
         <span class="keyword">return</span>;

     document<span class="operator">-</span><span class="operator">&gt;</span>print(<span class="operator">&amp;</span>printer);

     statusBar()<span class="operator">-</span><span class="operator">&gt;</span>showMessage(tr(<span class="string">"Ready"</span>)<span class="operator">,</span> <span class="number">2000</span>);
 <span class="preprocessor">#endif</span>
 }
</pre>
<p>Use the <a href="qstatusbar.html#currentMessage">currentMessage</a>() function to
retrieve the temporary message currently shown. The QStatusBar
class also provide the <a href="qstatusbar.html#messageChanged">messageChanged</a>() signal which
is emitted whenever the temporary status message changes.</p>
<a id="permanent-message" name="permanent-message" />
<p><i>Normal</i> and <i>Permanent</i> messages are displayed by
creating a small widget (<a href="qlabel.html">QLabel</a>, <a href="qprogressbar.html">QProgressBar</a> or even <a href="qtoolbutton.html">QToolButton</a>) and then adding it to the
status bar using the <a href="qstatusbar.html#addWidget">addWidget</a>() or the <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>()
function. Use the <a href="qstatusbar.html#removeWidget">removeWidget</a>() function to
remove such messages from the status bar.</p>
<pre class="cpp">
 statusBar()<span class="operator">-</span><span class="operator">&gt;</span><a href="qstatusbar.html#addWidget">addWidget</a>(<span class="keyword">new</span> MyReadWriteIndication);
</pre>
<p>By default QStatusBar provides a <a href="qsizegrip.html">QSizeGrip</a> in the lower-right corner. You can
disable it using the <a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a>()
function. Use the <a href="qstatusbar.html#sizeGripEnabled-prop">isSizeGripEnabled</a>()
function to determine the current status of the size grip.</p>
<p class="centerAlign"><img alt="A status bar shown in the Plastique widget style" src="images/plastique-statusbar.png" /></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStatusBar" />QStatusBar.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a status bar with a size grip and the given
<i>parent</i>.</p>
<p><b>See also</b> <a href="qstatusbar.html#sizeGripEnabled-prop">setSizeGripEnabled</a>().</p>


<h3 class="fn"><a name="addPermanentWidget" />QStatusBar.addPermanentWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>widget</i> permanently to this status bar,
reparenting the widget if it isn't already a child of this <a href="qstatusbar.html">QStatusBar</a> object. The <i>stretch</i>
parameter is used to compute a suitable size for the given
<i>widget</i> as the status bar grows and shrinks. The default
stretch factor is 0, i.e giving the widget a minimum of space.</p>
<p>Permanently means that the widget may not be obscured by
temporary messages. It is is located at the far right of the status
bar.</p>
<p><b>See also</b> <a href="qstatusbar.html#insertPermanentWidget">insertPermanentWidget</a>(),
<a href="qstatusbar.html#removeWidget">removeWidget</a>(), and
<a href="qstatusbar.html#addWidget">addWidget</a>().</p>


<h3 class="fn"><a name="addWidget" />QStatusBar.addWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>widget</i> to this status bar, reparenting the
widget if it isn't already a child of this <a href="qstatusbar.html">QStatusBar</a> object. The <i>stretch</i>
parameter is used to compute a suitable size for the given
<i>widget</i> as the status bar grows and shrinks. The default
stretch factor is 0, i.e giving the widget a minimum of space.</p>
<p>The widget is located to the far left of the first permanent
widget (see <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>()) and
may be obscured by temporary messages.</p>
<p><b>See also</b> <a href="qstatusbar.html#insertWidget">insertWidget</a>(), <a href="qstatusbar.html#removeWidget">removeWidget</a>(), and <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>().</p>


<h3 class="fn"><a name="clearMessage" />QStatusBar.clearMessage (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clearMessage()</tt>.</p><p>Removes any temporary message being shown.</p>
<p><b>See also</b> <a href="qstatusbar.html#currentMessage">currentMessage</a>(), <a href="qstatusbar.html#showMessage">showMessage</a>(), and <a href="qstatusbar.html#removeWidget">removeWidget</a>().</p>


<h3 class="fn"><a name="currentMessage" />QString QStatusBar.currentMessage (<i>self</i>)</h3><p>Returns the temporary message currently shown, or an empty
string if there is no such message.</p>
<p><b>See also</b> <a href="qstatusbar.html#showMessage">showMessage</a>().</p>


<h3 class="fn"><a name="event" />bool QStatusBar.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="hideOrShow" />QStatusBar.hideOrShow (<i>self</i>)</h3><p>Ensures that the right widgets are visible.</p>
<p>Used by the <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>() functions.</p>


<h3 class="fn"><a name="insertPermanentWidget" />int QStatusBar.insertPermanentWidget (<i>self</i>, int&#160;<i>index</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Inserts the given <i>widget</i> at the given <i>index</i>
permanently to this status bar, reparenting the widget if it isn't
already a child of this <a href="qstatusbar.html">QStatusBar</a>
object. If <i>index</i> is out of range, the widget is appended (in
which case it is the actual index of the widget that is
returned).</p>
<p>The <i>stretch</i> parameter is used to compute a suitable size
for the given <i>widget</i> as the status bar grows and shrinks.
The default stretch factor is 0, i.e giving the widget a minimum of
space.</p>
<p>Permanently means that the widget may not be obscured by
temporary messages. It is is located at the far right of the status
bar.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>(),
<a href="qstatusbar.html#removeWidget">removeWidget</a>(), and
<a href="qstatusbar.html#addWidget">addWidget</a>().</p>


<h3 class="fn"><a name="insertWidget" />int QStatusBar.insertWidget (<i>self</i>, int&#160;<i>index</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>, int&#160;<i>stretch</i>&#160;=&#160;0)</h3><p>The <i>widget</i> argument has it's ownership transferred to Qt.</p><p>Inserts the given <i>widget</i> at the given <i>index</i> to
this status bar, reparenting the widget if it isn't already a child
of this <a href="qstatusbar.html">QStatusBar</a> object. If
<i>index</i> is out of range, the widget is appended (in which case
it is the actual index of the widget that is returned).</p>
<p>The <i>stretch</i> parameter is used to compute a suitable size
for the given <i>widget</i> as the status bar grows and shrinks.
The default stretch factor is 0, i.e giving the widget a minimum of
space.</p>
<p>The widget is located to the far left of the first permanent
widget (see <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>()) and
may be obscured by temporary messages.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qstatusbar.html#addWidget">addWidget</a>(), <a href="qstatusbar.html#removeWidget">removeWidget</a>(), and <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>().</p>


<h3 class="fn"><a name="isSizeGripEnabled" />bool QStatusBar.isSizeGripEnabled (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QStatusBar.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<p>Shows the temporary message, if appropriate, in response to the
paint <i>event</i>.</p>


<h3 class="fn"><a name="reformat" />QStatusBar.reformat (<i>self</i>)</h3><p>Changes the status bar's appearance to account for item
changes.</p>
<p>Special subclasses may need this function, but geometry
management will usually take care of any necessary
rearrangements.</p>


<h3 class="fn"><a name="removeWidget" />QStatusBar.removeWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>Removes the specified <i>widget</i> from the status bar.</p>
<p><b>Note:</b> This function does not delete the widget but
<i>hides</i> it. To add the widget again, you must call both the
<a href="qstatusbar.html#addWidget">addWidget</a>() and <a href="qwidget.html#show">show</a>() functions.</p>
<p><b>See also</b> <a href="qstatusbar.html#addWidget">addWidget</a>(), <a href="qstatusbar.html#addPermanentWidget">addPermanentWidget</a>(), and
<a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>


<h3 class="fn"><a name="resizeEvent" />QStatusBar.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>


<h3 class="fn"><a name="setSizeGripEnabled" />QStatusBar.setSizeGripEnabled (<i>self</i>, bool)</h3><h3 class="fn"><a name="showEvent" />QStatusBar.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#showEvent">QWidget.showEvent</a>().</p>


<h3 class="fn"><a name="showMessage" />QStatusBar.showMessage (<i>self</i>, QString&#160;<i>message</i>, int&#160;<i>msecs</i>&#160;=&#160;0)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showMessage(const QString&amp;,int = 0)</tt>.</p><p>Hides the normal status indications and displays the given
<i>message</i> for the specified number of milli-seconds
(<i>timeout</i>). If <i>timeout</i> is 0 (default), the
<i>message</i> remains displayed until the <a href="qstatusbar.html#clearMessage">clearMessage</a>() slot is called or
until the showMessage() slot is called again to change the
message.</p>
<p>Note that showMessage() is called to show temporary explanations
of tool tip texts, so passing a <i>timeout</i> of 0 is not
sufficient to display a <a href="qstatusbar.html#permanent-message">permanent message</a>.</p>
<p><b>See also</b> <a href="qstatusbar.html#messageChanged">messageChanged</a>(), <a href="qstatusbar.html#currentMessage">currentMessage</a>(), and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="messageChanged" />void messageChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the temporary status message
changes. The new temporary message is passed in the <i>message</i>
parameter which is a null-string when the message has been
removed.</p>
<p><b>See also</b> <a href="qstatusbar.html#showMessage">showMessage</a>() and <a href="qstatusbar.html#clearMessage">clearMessage</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>